/*
 * @Author: 李小晴 2689279066@qq.com
 * @Date: 2023-03-14 10:49:42
 * @LastEditors: 李小晴 2689279066@qq.com
 * @LastEditTime: 2023-08-25 20:47:34
 * @FilePath: \sys\src\api\file\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { useAxios } from '@/hooks/web/useAxios'
const request = useAxios()
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()

// 文件列表
export const sysFileListApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileList',
      data: data
    }
  })
}

// 文件列表
export const sysFileListFileApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileListFile',
      data: data
    }
  })
}

// 文件夹树
export const sysFileTreeFolderApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileTreeFolder',
      data: data
    }
  })
}
// 文件夹树
export const sysFileFolderTreeApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileFolderTree',
      data: data
    }
  })
}

// 新增
export const sysFileAddApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileAdd',
      data: data
    }
  })
}

// 文件夹新增
export const sysFileAddFolder = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileAddFolder',
      data: data
    }
  })
}

// 文件编辑
export const sysFileEditApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileEdit',
      data: data
    }
  })
}

// 文件夹编辑
export const sysFileEditFolderApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileEditFolder',
      data: data
    }
  })
}

// 附件编辑
export const sysFileEditFileApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileEditFile',
      data: data
    }
  })
}
// 附件上传
export const sysFileAddFileApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileAddFile',
      data: data
    }
  })
}

// 附件删除
export const sysFileDelFileApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileDelFile',
      data: data
    }
  })
}
// 文件夹删除
export const sysFileDelFolderApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileDelFolder',
      data: data
    }
  })
}

// 文件夹删除
export const sysFileDelApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileDel',
      data: data
    }
  })
}

// 批量转移
export const sysFileBatchShiftApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileBatchShift',
      data: data
    }
  })
}

// 批量复制
export const sysFileBatchCopyApi = (data: any) => {
  return request.post({
    url: 'index.php/api/file/batch_copy',
    headers: { token: wsCache.get('token') },
    data: data
  })
}

// 批量删除
export const sysFileBatchDelApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileBatchDel',
      data: data
    }
  })
}

// 面包屑列表
export const sysFileSeeFolderBreadcrumbApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileSeeFolderBreadcrumb',
      data: data
    }
  })
}

// 面包屑列表
export const sysFileSeeBreadcrumbApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'sysFileSeeBreadcrumb',
      data: data
    }
  })
}
